﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using DependencyLocate.Abstract;
namespace DependencyLocate.Imp
{
    internal static class FactoryContainer
    {
        public static IFactory Factory { get; private set; }
        static FactoryContainer()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load("E:\\MyStudyProject\\Delegate\\Dependency\\Config\\Config.xml");
            XmlNode xmlNode = xmlDoc.ChildNodes[1].ChildNodes[0].ChildNodes[0];
            if ("Mac" == xmlNode.Value)
            {
                Factory = new MacFactory();
            }
            else if ("Windown" == xmlNode.Value)
            {
                Factory = new WinFactory();
            }
            else
            {
                throw new Exception("Factory init error!");
            }
        }
    }
}